﻿using LiveCharts.Wpf;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace Wpf_Examples.Views
{
    /// <summary>
    /// RollingNumWindow.xaml 的交互逻辑
    /// </summary>
    public partial class RollingNumWindow : Window
    {
        public RollingNumWindow()
        {
            InitializeComponent();


            //创建定时器
            CreateTimer();
        }

        private void CreateTimer()
        {
            #region 每秒定时器服务
            DispatcherTimer cpuTimer = new DispatcherTimer
            {
                Interval = new TimeSpan(0, 0, 0, 1, 0)
            };
            cpuTimer.Tick += DispatcherTimer_Tick;
            cpuTimer.Start();
            #endregion
        }

        private void DispatcherTimer_Tick(object sender, EventArgs e)
        {
            Random rnd = new Random();
            number.Number=(int)rnd.Next(0,999);

            Random rnd2 = new Random();
            num1.Num = (int)rnd.Next(0, 9);
            num2.Num = (int)rnd.Next(0, 9);
        }
    }
}
